package com.jason.www.dao;

import com.jason.www.domain.Orders;
import org.apache.ibatis.jdbc.SQL;

public class OrdersSqlProvider {

    public String insertSelective(Orders record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("orders");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=BIGINT}");
        }
        
        if (record.getUserId() != null) {
            sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}");
        }
        
        if (record.getNumber() != null) {
            sql.VALUES("number", "#{number,jdbcType=VARCHAR}");
        }
        
        if (record.getCreatetime() != null) {
            sql.VALUES("createtime", "#{createtime,jdbcType=DATE}");
        }
        
        if (record.getNote() != null) {
            sql.VALUES("note", "#{note,jdbcType=LONGVARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(Orders record) {
        SQL sql = new SQL();
        sql.UPDATE("orders");
        
        if (record.getUserId() != null) {
            sql.SET("user_id = #{userId,jdbcType=BIGINT}");
        }
        
        if (record.getNumber() != null) {
            sql.SET("number = #{number,jdbcType=VARCHAR}");
        }
        
        if (record.getCreatetime() != null) {
            sql.SET("createtime = #{createtime,jdbcType=DATE}");
        }
        
        if (record.getNote() != null) {
            sql.SET("note = #{note,jdbcType=LONGVARCHAR}");
        }
        
        sql.WHERE("id = #{id,jdbcType=BIGINT}");
        
        return sql.toString();
    }
}